package com.uinnova.product.eam.service.cmdb.flowable;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public enum CategoryEnum {
    PARENT_SYSTEM("父系统", "0"),
    SUB_SYSTEM("子系统", "1");

    private final String label;
    private final String value;

    CategoryEnum(String label, String value) {
        this.label = label;
        this.value = value;
    }

    public String getLabel() {
        return label;
    }

    public String getValue() {
        return value;
    }


    public Map<String, String> toMap() {
        Map<String, String> map = new HashMap<>();
        map.put("label", label);
        map.put("value", value);
        return Collections.unmodifiableMap(map);
    }

    public static Map<String, String> getMapByLabel(String label) {
        for (SysStatusEnum status : SysStatusEnum.values()) {
            if (status.getLabel().equals(label)) {
                return status.toMap();
            }
        }
        return Collections.emptyMap(); // 如果未找到匹配项，返回空Map
    }
}
